<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>回收袋子</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="${s.base}/js/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="${s.base}/css/base/base.css?123456" media="all" /></head>

<body class="childrenBody">
<form class="layui-form">
	<input type="hidden" class="layui-input" name="status" value="1" />
	<div class="layui-form-item layui-row layui-col-xs12">
		<label class="layui-form-label">
			<span class="red">*</span>&nbsp;&nbsp;用户编号</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input" id="cardNo" name="cardNo" placeholder="请输入用户编号" lay-verify="required" autocomplete="off" />
		</div>
		<div class="layui-input-block">
			<button class="layui-btn layui-btn-sm" type="button" id="searchMember">确认</button>
		</div>
	</div>

	<div class="layui-form-item layui-row layui-col-xs12">
		<label class="layui-form-label">
			<span class="red">*</span>&nbsp;&nbsp;用户昵称</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input" id="memberNickName" name="memberNickName" disabled/>
			<input type="hidden" class="layui-input" id="memberId" name="memberId" disabled/>
		</div>
	</div>

	<div class="layui-form-item layui-row layui-col-xs12">
		<label class="layui-form-label">
			<span class="red">*</span>&nbsp;&nbsp;回收内容</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input" name="content" placeholder="请输入回收内容" lay-verify="required" autocomplete="off" />
		</div>
	</div>

	<div class="layui-form-item layui-row layui-col-xs12">
		<div class="layui-input-block">
			<button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="submitBtn">确定</button>
			<button type="reset" class="layui-btn layui-btn-sm layui-btn-primary cancel">取消</button>
		</div>
	</div>
</form>
<script type="text/javascript" src="${s.base}/js/layui/layui.js"></script>
<script type="text/javascript" src="${s.base}/js/base/base.js"></script>
<script type="text/javascript">layui.use(['form', 'jquery', 'baseUtil','dialogUtil'],
    function() {
        var form = layui.form,
            $ = layui.jquery,
            dialogUtil = layui.dialogUtil,
            baseUtil = layui.baseUtil;

        $("#searchMember").on("click",function () {
            var cardNo = $("#cardNo").val();
            if (cardNo == null || cardNo == "") {
                dialogUtil.alert("请输入用户编号");
                return false;
            }
            baseUtil.postMethodResult("/webMember/selectEntityByCardNo", {cardNo:cardNo},
                function(result) {
                    // result
                    console.log(result)
                    $("#memberNickName").val(result.nickName);
                    $("#memberId").val(result.id);
                });
            return false;
        });

        form.on('submit(submitBtn)',
            function(data) {
            	var memberId = data.field.memberId;
				if (memberId == null || memberId == "") {
				    return false;
				}
                baseUtil.postMethodResult("/recoverySackRecord/addOrUpdate", data.field,
                    function(result) {
                        parent.location.reload();
                        parent.parent.tabAddUrl("/recoverySackDetail/recoverySackRecordDetailList?recordId="+result.id+"&status="+result.status,result.memberName + "["+result.memberCardNo+"]订单详情");
                    });
                return false;
            });
    });
</script>
</body>

</html>